IOS Tricks with TCLs

Parser

Find the subcommands under a specific command such as ‘Clear’ that contain “call” keyword. Example: clear call voice …

Router# show parser dump exec | inc clear .*[a-z]+.*call

1 clear controller call-counters timeslots
1 clear controller call-counters timeslots
1 clear controller call-counters timeslots
1 clear controller call-counters timeslots
1 clear controller call-counters timeslots
1 clear controller call-counters timeslots
1 clear controller call-counters
1 clear controller call-counters system-hwm
1 clear controller call-counters all
1 clear call voice causecode long-dur-call
1 clear call voice causecode calling-number
1 clear call voice causecode called-number
1 clear call threshold total-calls
1 clear call threshold total-calls
1 clear call threshold interface int-calls
1 clear call threshold interface int-calls
1 clear crypto call admission statistics
 
 

TCL Script to Ping Group of Addresses

Router# tclsh
foreach address {
10.0.0.1
10.0.0.2
10.0.0.3
} { ping $address re 3 ti 1 }
Type escape sequence to abort.
Sending 101500-byte ICMP Echos to 172.12.23.2, timeout is 2 seconds:
!!!!!!!!!!
It is useful to test your network reachability whenever you perform a change in routing system.

Define a Ping Macro for Catalyst Switches

Since TCL is not supported by Catalyst switches, we need to define a macro to ping addresses:

Switch(config)# macro name PING
do ping 10.0.0.100
do ping 10.0.1.100
do ping 10.0.2.100
@
Switch(config)# macro global apply PING
Type escape sequence to abort.
Sending 5100-byte ICMP Echos to 10.0.0.100, timeout is 2 seconds:
!!!!!

 

 

 

 

Posted in IOS